-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fixed issue #15192 #15241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fixed issue #15192 #15241
Conversation
Lintcheck changes for 2614a31
This comment will be updated if you push new changes |
The
(note also the quotes around This way it will be easily transformed into a link to the lint description when integrated in |
@samueltardieu Thanks ! I've updated the changelog line as suggested . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I personally feel like the help message for what we're expecting the user to do to resolve the lint (introduce indirection for example by boxing) was still helpful as a hint.
Even in #![no_std]
crates, one can still use extern crate alloc
and use alloc::boxed::Box<_>
that way (and I'd expect in practice this suggestion is very often still applicable), and even if the user doesn't have the alloc crate, I'd expect there would still be some other moral equivalent to introduce indirection
What do you think about instead of omitting this entirely in #![no_std]
crates, actually "downgrade" the suggestion to just the help message, so it still hints to the user what they can do about it. We could also slightly change the message in case the user really can't use Box<_>
. I'm thinking of something like:
help: consider boxing the large fields or introducing indirection in some other way to reduce the total size of the enum
@@ -0,0 +1,16 @@ | |||
#![no_std] | |||
#![no_main] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are built as library crates, so you should be able to largely simplify this. The #![no_main]
and panic handling code shouldn't be needed.
#![no_std]
#![warn(clippy::large_enum_variant)]
enum Myenum {
//~^ ERROR: large size difference between variants
Small(u8),
Large([u8; 1024]),
}
@y21 Thanks for the feedback . You are correct that a downgraded help message should be used . I will update my pull request to follow the same and also I'll edit out the |
@y21 I have implemented the suggestions you made . Please review it now. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Fixed issue by adding checks for no_std whild giving out Box recommendation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Fixed issue by adding checks for no_std whild giving out Box recommendation
Fixes #15192 by adding checks for no_std while giving out Box recommendation